/*
 * Copyright (c) 2007 Compl Yue Still, All Rights Reserved.
 */

package hbi.wire.as3.guest
{
	import flash.utils.IDataOutput;

	public class ForecastedType
	{
		
		private var _output:IDataOutput;
		private var _index:int;
		
		public function ForecastedType(output:IDataOutput, index:int)
		{
			this._output = output;
			this._index = index;
		}
		
		private var _methods:Object = {};
		private var _methodCount:int = 0;

		public function methodIndex(mangledMethodName:String):int
		{
			var idx:* = _methods[mangledMethodName];
			if(idx) return int(idx);
			_output.writeByte('m'.charCodeAt());
			_output.writeUTF(mangledMethodName);
			return _methods[mangledMethodName] = _methodCount++;
		}
		
		public function get index():int
		{
			return _index;
		}
		
	}
	
}
